package com.huluobo.a2204kotlinshopping.category

import androidx.lifecycle.MutableLiveData
import com.huluobo.base.bean.CategoryBeanResult
import com.huluobo.base.bean.CategoryGoodsListBeanResult
import com.huluobo.base.viewmodel.BaseViewModel

/**
 *  Created by LC on 2024/7/27.
 */
class CategoryViewModel : BaseViewModel<CategoryRepo>() {
    val getCategoryListSuccess = MutableLiveData<CategoryBeanResult>()
    val getCategoryListFailed = MutableLiveData<String>()

    val getCategoryGoodsListSuccess = MutableLiveData<CategoryGoodsListBeanResult>()
    val getCategoryGoodsListFailed = MutableLiveData<String>()

    fun getCategoryGoodsList(categoryId: Int, currentPage: Int, pageSize: Int) {
        repo.getCategoryGoodsList(
            categoryId,
            currentPage,
            pageSize,
            getCategoryGoodsListSuccess,
            getCategoryGoodsListFailed
        )
    }

    fun getCategoryList() {
        repo.getCategoryList(getCategoryListSuccess, getCategoryListFailed)
    }

    override fun createRepo(): CategoryRepo = CategoryRepo()
}